package Byte_Stream;

import java.io.*;

public class IO_Demo07 {
    public static void main(String[] args){
        // 使用 OutputStream 来写文件，以附加模式打开文件(在之前文件内容之后追加写)
        try(OutputStream outputStream = new FileOutputStream("./text4.txt",true)){
            byte[] buffer = new byte[]{97,98,99,100,101,102};
            outputStream.write(buffer);

            // 添加换行符，使用系统默认的换行符
            String lineSeparator = System.lineSeparator();
            outputStream.write(lineSeparator.getBytes());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
